import styled from '@emotion/styled';
import React from 'react';
import { useTranslation } from 'react-i18next';

interface TestimonyDeatilProsp {
	data: any;
	userRole: string;
}

const TranscriptDeatilContainer = styled.div`
	margin: 0 14px;
`;

const TranscriptResultTitle = styled.span`
	display: inline-block;
	font-size: 12px;
	color: #2a2a2a;
	margin-bottom: 10px;
`;

const TranscriptResultBox = styled.div`
	padding-bottom: 18px;
	border-bottom: 1px solid #f1f1f1;
`;

const Result = styled.div`
	width: 312px;
	height: 58px;
	background: #fafafb;
`;

const TranscriptCopywritingBox = styled.div`
	padding-top: 18px;
`;

const TranscriptCopywritingTitle = styled.span`
	display: inline-block;
	font-size: 12px;
	color: #2a2a2a;
	margin-bottom: 10px;
`;

const Copywriting = styled.p`
	font-size: 12px;
	color: #2d2d2d;
`;

const Img = styled.img`
	width: 100%;
	height: 100%;
`;

const UserRole = styled.span`
	font-size: 12px;
	color: #666666;
	margin-bottom: 6px;
	visibility: ${(props: { userRole: string }) => (props.userRole === 'normal' ? 'hidden' : '')};
`;

const TranscriptDetail = (props: TestimonyDeatilProsp) => {
	const { t } = useTranslation();
	const { data, userRole } = props;
	return (
		<TranscriptDeatilContainer>
			<UserRole userRole={userRole}>{userRole}</UserRole>
			<TranscriptResultBox>
				<TranscriptResultTitle>{t('transcript-result')}</TranscriptResultTitle>
				<Result>{data.data ? <Img src={data.data}></Img> : null}</Result>
			</TranscriptResultBox>
			<TranscriptCopywritingBox>
				<TranscriptCopywritingTitle>{t('transcript-copy')}</TranscriptCopywritingTitle>
				<Copywriting>{data.text}</Copywriting>
			</TranscriptCopywritingBox>
		</TranscriptDeatilContainer>
	);
};

export default TranscriptDetail;
